var Contest=Contest||{};
fastCSharp.Copy(Contest,{
LoadTime:function()
	{
	if(!this.TimeValue)
		{
		this.TimeValue={IsEnd:0};
		this.CheckTimeFunction=fastCSharp.ThisFunction(this,this.CheckTime);
		}
	else if(this.TimeInterval)
		{
		clearTimeout(this.TimeInterval);
		this.TimeValue.IsEnd=0;
		}
	this.CheckTime();
	},
CheckTime:function()
	{
	this.TimeInterval=0;
	var SkinValue=fastCSharp.PageView.SkinValue.SkinValue,Contest=SkinValue.contest,Now=SkinValue.serverTime.Now();
	if(Now<Contest.EndTime)
		{
		var Timeout=Now.getTime()-Contest.StartTime.getTime();
		if(Timeout<0)	this.CheckReLoad=1;
		else if(this.CheckReLoad)
			{
			this.CheckReLoad=0;
			this.OnTime();
			return;
			}
		this.TimeInterval=setTimeout(this.CheckTimeFunction,Timeout<0?-Timeout%1000:(1000-Timeout%1000));
		if(this.TimeValue.IsStart=(Timeout>=0))	Timeout=Now.getTime()-Contest.EndTime.getTime();
		this.TimeValue.Days=Math.floor(-Timeout/(1000*60*60*24));
		this.TimeValue.Hours=Math.floor((-Timeout/(1000*60*60))%24);
		this.TimeValue.Minutes=Math.floor((-Timeout/(1000*60))%60);
		this.TimeValue.Seconds=Math.floor((-Timeout/1000)%60);
		fastCSharp.Skins.serverTime.Show(this.TimeValue);
		}
	else	this.TimeOver();
	},
TimeOver:function()
	{
	clearTimeout(this.TimeInterval);
	this.TimeValue.IsEnd=1;
	fastCSharp.Skins.serverTime.Show(this.TimeValue);
	},
OnTime:function()
	{
	location.reload();
	}
		});
fastCSharp.OnLoad(Contest.LoadTime,Contest);